﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using TravelLink.DAL;

namespace TravelLink.WebApp.Admin
{
    public partial class AdminUserPositionCollect : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if ((this.Request.QueryString["PositionCode"] ?? "") != string.Empty)
                {
                    this.LinqDataSource1.Where = "PositionCode=@PositionCode";
                    this.LinqDataSource1.WhereParameters.Add("PositionCode", System.Data.DbType.Guid, this.Request.QueryString["PositionCode"]);
                }
                if ((this.Request.QueryString["UserCode"] ?? "") != string.Empty)
                {
                    this.LinqDataSource1.Where = "UserCode=@UserCode";
                    this.LinqDataSource1.WhereParameters.Add("UserCode", System.Data.DbType.Guid, this.Request.QueryString["UserCode"]);
                }                
            }
        }

        protected void ASPxGridView1_HtmlDataCellPrepared(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewTableDataCellEventArgs e)
        {
            if (e.DataColumn.Caption == "姓名")
            {
                TL_User_Position_Collect obj = this.ASPxGridView1.GetRow(e.VisibleIndex) as TL_User_Position_Collect;
                e.Cell.Text = (obj.TL_User.CLastName ?? "") + (obj.TL_User.CFirstName ?? "");
            }
        }
    }
}